from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
from app.core.database import Base

class Grade(Base):
    __tablename__ = "grades"
    
    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    name = Column(String(50), nullable=False, unique=True)
    level = Column(Integer, nullable=False, unique=True)
    
    knowledge_points = relationship("KnowledgePoint", back_populates="grade")
    questions = relationship("Question", back_populates="grade_rel")